Skip to content

refs #14599 - added OneShotTimer / moved some ShowTime logic out of Timer / added more --showtime tests#8435

Open
firewave wants to merge 2 commits intocppcheck-opensource:mainfrom
firewave:singletimer
Open

refs #14599 - added OneShotTimer / moved some ShowTime logic out of Timer / added more --showtime tests#8435
firewave wants to merge 2 commits intocppcheck-opensource:mainfrom
firewave:singletimer

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

@firewave firewave commented Apr 9, 2026

No description provided.

@firewave

This comment was marked as resolved.

@firewave firewave force-pushed the singletimer branch 3 times, most recently from 9aaef72 to f44ba03 Compare April 12, 2026 07:22
@firewave firewave marked this pull request as ready for review April 12, 2026 07:22
@firewave firewave marked this pull request as draft April 12, 2026 07:32
@firewave firewave force-pushed the singletimer branch 4 times, most recently from 489bff5 to 2986b72 Compare April 12, 2026 17:27
@firewave firewave changed the title refs #14599 - added OneShotTimer / moved some ShowTime logic out of Timer refs #14599 - added OneShotTimer / moved some ShowTime logic out of Timer added more --showtime tests Apr 12, 2026
@firewave firewave changed the title refs #14599 - added OneShotTimer / moved some ShowTime logic out of Timer added more --showtime tests refs #14599 - added OneShotTimer / moved some ShowTime logic out of Timer / added more --showtime tests Apr 12, 2026
@firewave firewave force-pushed the singletimer branch 2 times, most recently from 7517433 to 5a76a28 Compare April 12, 2026 17:59
@firewave firewave marked this pull request as ready for review April 12, 2026 17:59
@sonarqubecloud
Copy link
Copy Markdown

Comment thread cli/cppcheckexecutor.cpp
Timer realTimeClock("Overall time", settings.showtime, &overallTimerResults, Timer::Type::OVERALL);
std::unique_ptr<OneShotTimer> overallTimer;
if (settings.showtime == ShowTime::SUMMARY || settings.showtime == ShowTime::TOP5_SUMMARY)
overallTimer.reset(new OneShotTimer("Overall time", settings.showtime));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works. I am not against it. I am just thinking that the unique_ptr and new is unfortunate of course and maybe an alternative could be:

    OneShotTimer overallTimer("Overall time", settings.showtime);
    overallTimer.start(settings.showtime == ShowTime::SUMMARY || settings.showtime == ShowTime::TOP5_SUMMARY);

But what do you think?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not to have additional functions which are callable to keep the interface simple. I might also rework this again a bit (not completely sure how yet) after the implementation and interface have been separated. But I am not there yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants